package com.yfp.tissue.api.factory;

import com.yfp.common.core.domain.R;
import com.yfp.tissue.api.RemotePositionService;
import com.yfp.tissue.domain.Position;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 
 * @version 1.0
 * @date 2024-08-13 15:51
 */
@Component
public class RemotePositionFallbackFactory implements FallbackFactory<RemotePositionService> {
    @Override
    public RemotePositionService create(Throwable cause) {
        return new RemotePositionService() {

            @Override
            public R<Position> getInfoByMachineId(String machineId) {
                return R.fail("获取点位信息异常：" + cause.getMessage());
            }

            @Override
            public R<List<Position>> getPositionList(String cityName) {
                return R.fail("获取点位列表异常：" + cause.getMessage());
            }
        };


    }
}
